using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NuSoft.Business.Framework;
using NuSoft.Business;

namespace NSFxSamples.CustomQueries
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            EntityList<Customer> list = Customer.Custom_GetCustomersWhereFirstNameStartsWith(txtSearchCriteria.Text);
            this.rpCustomersByTerritory.DataSource = list;
            this.rpCustomersByTerritory.DataBind();
        }
        protected void rpCustomersByTerritory_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Contact cont = ((Customer)e.Item.DataItem).Individual.Contact;
                ((Literal)e.Item.FindControl("litCustName")).Text += string.Format("{0} {1}", cont.FirstName, cont.LastName);
            }
        }

    }//class
}//namespace
